// import Vue from 'vue'
import Router from 'vue-router';

Vue.use(Router);

// app整体由店面页和店内页组成 暂时并没有用到嵌套路由
const routes = [{
    path: '/',
    name: "新津农博园",
    component: resolve => require(["../views/home/home.vue"], resolve)
}, {
    path: '/home',
    name: "工作台",
    components: {
        "default": resolve => require(["../views/home/home.vue"], resolve),
        "subPage": resolve => require(["../views/home/workspace.vue"], resolve)
    }
}, {
    path: '/screen',
    name: "大屏屏幕",
    components: {
        "default": resolve => require(["../views/home/home.vue"], resolve),
        "subPage": resolve => require(["../views/screen/main.vue"], resolve)
    }
}];

// 设置路由信息
const router = new Router({ base: "/", routes, });

// history模式跳转到新页面，返回顶部
router.afterEach((to, from, next) => {
    window.scrollTo(0, 0);
});

export default router;